package cn.meibang.common.beauty.provider.dao;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import cn.meibang.common.beauty.provider.domain.BeautyConsultationOrderQuestion;

public class BeautyConsultationOrderQuestionSqlProvider {

    public String insertSelective(BeautyConsultationOrderQuestion record) {
        BEGIN();
        INSERT_INTO("beauty_consultation_order_question");
        
        if (record.getId() != null) {
            VALUES("id", "#{id,jdbcType=BIGINT}");
        }
        
        if (record.getOrderId() != null) {
            VALUES("order_id", "#{orderId,jdbcType=BIGINT}");
        }
        
        if (record.getQuestionTitle() != null) {
            VALUES("question_title", "#{questionTitle,jdbcType=VARCHAR}");
        }
        
        if (record.getQuestionNo() != null) {
            VALUES("question_no", "#{questionNo,jdbcType=INTEGER}");
        }
        
        if (record.getQuestionImage() != null) {
            VALUES("question_image", "#{questionImage,jdbcType=VARCHAR}");
        }
        
        if (record.getAnswerType() != null) {
            VALUES("answer_type", "#{answerType,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateBy() != null) {
            VALUES("create_by", "#{createBy,jdbcType=BIGINT}");
        }
        
        if (record.getCreateDate() != null) {
            VALUES("create_date", "#{createDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            VALUES("update_by", "#{updateBy,jdbcType=BIGINT}");
        }
        
        if (record.getUpdateDate() != null) {
            VALUES("update_date", "#{updateDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRemarks() != null) {
            VALUES("remarks", "#{remarks,jdbcType=VARCHAR}");
        }
        
        if (record.getDelFlag() != null) {
            VALUES("del_flag", "#{delFlag,jdbcType=CHAR}");
        }
        
        if (record.getInstitutionId() != null) {
            VALUES("institution_id", "#{institutionId,jdbcType=BIGINT}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(BeautyConsultationOrderQuestion record) {
        BEGIN();
        UPDATE("beauty_consultation_order_question");
        
        if (record.getOrderId() != null) {
            SET("order_id = #{orderId,jdbcType=BIGINT}");
        }
        
        if (record.getQuestionTitle() != null) {
            SET("question_title = #{questionTitle,jdbcType=VARCHAR}");
        }
        
        if (record.getQuestionNo() != null) {
            SET("question_no = #{questionNo,jdbcType=INTEGER}");
        }
        
        if (record.getQuestionImage() != null) {
            SET("question_image = #{questionImage,jdbcType=VARCHAR}");
        }
        
        if (record.getAnswerType() != null) {
            SET("answer_type = #{answerType,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateBy() != null) {
            SET("create_by = #{createBy,jdbcType=BIGINT}");
        }
        
        if (record.getCreateDate() != null) {
            SET("create_date = #{createDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            SET("update_by = #{updateBy,jdbcType=BIGINT}");
        }
        
        if (record.getUpdateDate() != null) {
            SET("update_date = #{updateDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRemarks() != null) {
            SET("remarks = #{remarks,jdbcType=VARCHAR}");
        }
        
        if (record.getDelFlag() != null) {
            SET("del_flag = #{delFlag,jdbcType=CHAR}");
        }
        
        if (record.getInstitutionId() != null) {
            SET("institution_id = #{institutionId,jdbcType=BIGINT}");
        }
        
        WHERE("id = #{id,jdbcType=BIGINT}");
        
        return SQL();
    }
}